// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults


document.observe("dom:loaded", function() {
  // the element in which we will observe all clicks and capture
  // ones originating from pagination links
  var container = $(document.body)

  if (container) {
    var img = new Image
    img.src = '/images/spinner.gif'

    function createSpinner() {
      new Element('img', { src: img.src, 'class': 'spinner' })
    }

    container.observe('click', function(e) {
      var el = e.element()
      if (el.match('.pagination a')) {
        el.up('.pagination').insert(createSpinner())
        new Ajax.Request(el.href, { method: 'get' })
        e.stop()
      }
    })
  }
})

function scroll_to(str) {
    var childElements = Element.childElements('college_list');
    for (var index = 0; index < childElements.length; index++) {
      var item = childElements[index];
      if(item != null) {
          if(item.id.toString().include(str)) {
              Effect.BlindDown(item.id.toString(),{duration: '1.2'});
          } else {
              item.hide();
          }
      }
    }
}

function CheckAllByID(_elementID)
{
    try
    {
        var checkboxes = $(_elementID).select('[type="checkbox"]');
        checkboxes.each(function(s, index) {
          if (s.checked==false && index!=0)
              {s.checked = true;}
          else if(index!=0)
              {s.checked = false;}
        }
       );
    }
    catch(e)
    { alert(e.description);}
}
function deselect(oElm, strTagName, strClassName){
  
   var arrElements = (strTagName == "*" && document.all)? document.all : oElm.getElementsByTagName(strTagName);

	    strClassName = strClassName.replace(/\-/g, "\\-");
	    var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
	    var oElement;
	    for(var i=0; i<arrElements.length; i++){
	        oElement = arrElements[i];
	        if(oRegExp.test(oElement.getAttribute("class"))){
             
                oElement.setAttribute('class','alpha')
	        }
	    }



}

function showadtabs(oElm, strTagName, strClassName,cLassname2){

   var arrElements = (strTagName == "*" && document.all)? document.all : oElm.getElementsByTagName(strTagName);

	    strClassName = strClassName.replace(/\-/g, "\\-");
	    var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
	    var oElement;
	    for(var i=0; i<arrElements.length; i++){
	        oElement = arrElements[i];
	        if(oRegExp.test(oElement.getAttribute("class"))){

                oElement.setAttribute('class',cLassname2)
	        }
    }
}

function get_verification_box()
{
    if ($('user_mobile_no').value!=='')
        {
            $('verification-box').style.display='block';
            $('submit_email').disabled;
         }
}